/***************************************************************************
 *   Copyright (C) 2009 by Bernhard Neuhofer   *
 *   mail@bneu.at   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef TAXISTANDROLLBACKABLEADAPTER_H
#define TAXISTANDROLLBACKABLEADAPTER_H
#include "rollbackableAdapter.h"
#include "modelentity.h"
#include "memento.h"
/**
* @brief TW Adapter for the TaxiStand ME.
*/
class TaxiStandRollbackableAdapter:public RollbackableAdapter
{
	public:

		/**
		 * RollbackableAdapter#createMemento
		 * @param modelentity
		 * @return
		 */
		virtual Memento* createMemento ( ModelEntity* modelentity );

		/**
		 * @see RollbackableAdapter#setMemento
		 * @param modelentity
		 * @param memento
		 */
		virtual void setMemento ( ModelEntity* modelentity,Memento* memento );

		/**
		* The memento is defined as a nested class here. Ir would be more in the
		* spirit of the memento pattern to define it as inner class of the model
		* entity but as we have to keep in mind that there ca be different
		* simulation strategies with different demands on the knowledge about
		* the ME this is the best we can do
		*/
	private:
	class TaxiStandRollbackableMemento:public Memento
		{
			private:
				/** The number of customers waiting at the taxistand */
				unsigned int _nrCustomers;
				/** The number of taxis waiting at the taxistand */
				unsigned int _nrTaxis;
			public:
				/**
				 *                      Constructs a memento for a taxistand, with the given number of taxis and customers.
				 * @param NrCustomers Number of waiting customers
				 * @param NrTaxis Number of waiting taxis
				 */
				TaxiStandRollbackableMemento ( 
					unsigned int NrCustomers, 
					unsigned int NrTaxis ) 
					:_nrCustomers ( NrCustomers ),
					 _nrTaxis ( NrTaxis ) {}

				/**
				 *                      Get the number of waiting customers
				 * @return The number of waiting customers
				 */
				virtual unsigned int getNrCustomers();
				/**
				 *Get the number of waiting taxis
				 * @return The number of waiting taxis
				 */
				virtual unsigned int getNrTaxis();
				/**
				 * Set the number of waiting customers
				 * @param customers The number of customers
				 */
				virtual void setNrCustomers ( unsigned int customers );
				/**
				 * Set the number of waiting taxis
				 * @param nrTaxis The number of taxis
				 */
				virtual void setNrTaxis ( unsigned int nrTaxis );

		};
};

#endif
